import "./assets/css/index.css"; //全局导入css
import { createApp } from "vue";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
import App from "./App.vue";
import router from "./router"; // 确保路径正确
import zhCn from "element-plus/es/locale/lang/zh-cn";
import pinia from "./store";

const app = createApp(App);

// 初始化 $icons 属性为空数组
app.config.globalProperties.$icons = [];

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.config.globalProperties.$icons.push(key);
  app.component(key, component);
}
app.use(ElementPlus, {
  locale: zhCn,
  zIndex: 300000000,
});
app.use(pinia); // 注册pinia（需先于 router，因路由守卫中使用了 store）
app.use(router); // 必须调用 use(router)
app.mount("#app");
